package com.example.hj.controller;

import com.example.hj.service.FeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by HuangJian on 2020/7/22.
 */
@RestController
public class FeignTestController {
    @Autowired
    private FeignService feignService;

    @RequestMapping("/feign")
    public String testRibbon() {

        String userId = "";
        //调用10次用户微服务
        for (int i = 1; i <= 10; i++) {
            //调用定义Feign客户端方法
            userId = feignService.getUser((long) i);
        }
        return userId;
    }
}
